<!doctype html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Template • TodoMVC</title>
	<link rel="stylesheet" href="node_modules/todomvc-common/base.css">
	<link rel="stylesheet" href="node_modules/todomvc-app-css/index.css">
	<!-- CSS overrides - remove if you don't need it -->
	<link rel="stylesheet" href="css/app.css">
</head>

<body>
	<section class="todoapp">
		<header class="header">
			<h1>任务列表</h1>
			<!-- 2、输入内容回车创建任务 -->
			<input class="new-todo" placeholder="今天要完成的任务是?" v-model.trim="msg" v-focus autofocus @keyup.13="add">
		</header>
		<!-- This section should be hidden by default and shown when there are todos -->
		<section class="main">
			<!-- 4、全选、不选和反选 -->
			<input id="toggle-all" class="toggle-all" type="checkbox" v-model="allCheck">
			<label for="toggle-all">Mark all as complete</label>
			<ul class="todo-list">
				<!-- These are here just to show the structure of the list items -->
				<!-- List items should get the class `editing` when editing and `completed` when marked as completed -->
				<!-- 1、准备渲染列表数据：注意li身上有两个准备好的类名：completed（已完成）editing(可编辑) -->
				<!-- 5.双击编辑任务项 -->
				<!-- 7.切换状态：数据进行切换（路由） -->
				<li :class="{completed:item.ischeck,editing:currenIndex==index}" v-for="(item,index) in filterTask"
					:key="item.id" @dblclick="edit(index)">
					<div class="view">
						<!-- 3、点击复选框可以：完成任务 -->
						<input class="toggle" type="checkbox" v-model="item.ischeck">
						<label>{{ item.title }}</label>
						<!-- 6.删除任务 -->
						<button class="destroy" @click="deleteItem(index)"></button>
					</div>
					<!-- 5.双击编辑任务项 -->
					<input class="edit" v-model="item.title" @blur="keepItem(index)"
						@keyup.13="$event.target.blur" v-focus2 />
				</li>

			</ul>
		</section>
		<!-- This footer should be hidden by default and shown when there are todos -->
		<footer class="footer" v-show="taskList.length">
			<!-- This should be `0 items left` by default -->
			<span class="todo-count"><strong>{{ total }}</strong> {{ total > 1 ? 'items' : 'item'}} left</span>
			<!-- Remove this if you don't implement routing -->
			<ul class="filters">
				<li>
					<a :class="{selected:hash=='all'}" href="#/all">All</a>
				</li>
				<li>
					<a :class="{selected:hash=='active'}" href="#/active">Active</a>
				</li>
				<li>
					<a :class="{selected:hash=='completed'}" href="#/completed">Completed</a>
				</li>
			</ul>
			<!-- Hidden if no completed items are left ↓ -->
			<!-- 8.清除所有的已完成任务 -->
			<button class="clear-completed" @click="removeAll" v-show="taskList.length - total">Clear completed</button>
		</footer>
	</section>

	<!-- Scripts here. Don't remove ↓ -->
	<script src="node_modules/todomvc-common/base.js"></script>
	<script src="./vue.js"></script>
	<script src="js/app.js"></script>
</body>

</html>
